﻿using System;
using ExFlash.Records;

namespace ExFlash.Tags
{
    public class ProtectTag : Tag
    {
        private readonly int _swfVersion;
        
        public StringRecord Password
        {
            get;
            private set;
        }

        public ProtectTag(int len, int version, Int32 offset)
            : base(TagCodes.Protect, len, offset)
        {
            _swfVersion = version;
        }

        public override void SwfDeserialize(BinaryBitReader reader)
        {
            if (_swfVersion >= 5 && TagLength > 0)
            {
                Password = new StringRecord(_swfVersion);
                Password.SwfDeserialize(reader);
            }
        }

        public override void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }
    }
}
